package se.webbzon.oschi01.nbt;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import se.webbzon.oschi01.singleton.Singleton;

public class ByteTagFactory extends AbstractTagFactory<Byte> implements Singleton {

	private ByteTagFactory() {
		super(Tags.TAG_BYTE, "TAG_Byte");
	}

	@Override public ByteTag readTag(String tagName, DataInputStream is) throws IOException {
		return new ByteTag(this,tagName,is.readByte());
	}

	@Override public void writeTag(Tag<Byte> tag, DataOutputStream dos) throws IOException {
		dos.writeByte(tag.getValue());
	}

	@Override public Tag<Byte> createTag(String tagName) {
		return new ByteTag(this,tagName, (byte) 0);
	}

}
